<?php
//参数类
class Config
{
	private $_data = array ();
	private static $_instance = null;
	private function __construct()
	{
	
	}
	
	private function __clone()
	{
	
	}
	
	static public function getInstance()
	{
		if (! self::$_instance instanceof self)
		{
			self::$_instance = new self ();
		}
		return self::$_instance;
	}
	
	public function get($name, $default = null)
	{
		$result = $default;
		if (array_key_exists ( $name, $this->_data ))
		{
			$result = $this->_data [$name];
		}
		return $result;
	}
	
	private function __get($name)
	{
		return $this->get ( $name );
	}
	
	private function __set($name, $value)
	{
		if (is_array ( $value ))
		{
			$this->_data [$name] = new self ( $value, true );
		} else
		{
			$this->_data [$name] = $value;
		}
	}
	
	private function __isset($name)
	{
		return isset ( $this->_data [$name] );
	}
	
	private function __unset($name)
	{
		
		unset ( $this->$name );	
	}
}